//个人信息修改
function grxiugai(){
    var gr = document.getElementsByTagName("input");
    if(gr[0].value == "" || gr[1].value =="" || gr[2].value ==""){
        alert("所填内容不能有空");
    }else{
        if(confirm("你确认修改吗?")){
            doAjax("admin/xiugai?username="+gr[0].value+"&password="+gr[1].value+"&nickname="+gr[2].value);
        }
    }
}

//删除
function shanchu(biao,id){
    if(confirm("确实要删除吗？")){
        location.href = "/"+biao+"/shanchu?id="+id;
        alert("已经删除！");
    }
}
//修改
function xiugai(biao,id){
    location.href = "/"+biao+"/xg?id="+id;
}
//搜索
function sousuo(biao){
    var name = document.getElementsByClassName("ss");
    if(name[0].value != "" || name[1].value != ""){
        location.href = "/"+biao+"/sousuo?dyg="+name[0].value+"&deg="+name[1].value;
    }
}

var xmlhttp;
function createXMLHttpRequest(){
	xmlhttp = new XMLHttpRequest();
	if(xmlhttp.overrideMimeType){
		xmlhttp.overrideMimeType("text/xml");
	}
}
function doAjax(url){
	createXMLHttpRequest();
	if(xmlhttp != null){
		xmlhttp.onreadystatechange = processRequest;
		xmlhttp.open("post",url,true,"","");
		xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		xmlhttp.send(null);
	}else {
		alert("XMLHttpRequest对象未初始化!");
	}
}
function processRequest(){
	if(xmlhttp.readyState == 4){
		if(xmlhttp.status == 200){
			var jieguo = xmlhttp.responseText;
            alert(jieguo);
            if(jieguo=="OK"){
                top.location.href = "gly.html";
            }
		}else{
			alert("校严用户名Ajax请求未正常放回!\nError:"+xmlhttp.status+""+xmlhttp.statusText);
		}
	}
}